{extend name="public/base" /} {block name="style"}
<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" />
<style type="text/css">
	body {
		background: #EEEEEE;
		margin: 0;
		padding: 0;
		font-family: "微软雅黑", Arial, Helvetica, sans-serif;
	}
	
	a {
		color: #006600;
		text-decoration: none;
	}
	
	a:hover {
		color: #990000;
	}
	
	.top {
		margin: 5px auto;
		color: #990000;
		text-align: center;
	}
	
	.info select {
		border: 1px #993300 solid;
		background: #FFFFFF;
	}
	
	.info {
		margin: 5px;
		text-align: center;
	}
	
	.info #show {
		color: #3399FF;
	}
	
	.bottom {
		text-align: right;
		font-size: 12px;
		color: #CCCCCC;
		width: 1000px;
	}
</style>
{/block} {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('agent/index')}">商家列表</a>
		</li>
		<li><strong>商家编辑</strong></li>
	</ol>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('edit')}">
					<input type="hidden" name="id" value="{$ad.id}" />
					<!--店铺基本信息-->
					<div class="form-group">
						<label class="col-sm-2 control-label">名称：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="store_name" name="store_name" value="{$ad.store_name}" class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">地理位置：</label>
						<div class="input-group col-sm-10">
							<div class="row" style="margin-left: 5px;">
								<select id="s_province" name="province" value="{$ad.province}" class="form-control" style="width: 120px;"></select>
								<select id="s_city" name="city" value="{$ad.city}" class="form-control" style="width: 120px;"></select>
								<select id="s_county" name="district" value="{$ad.district}" class="form-control" style="width: 120px;"></select>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">所属行业：</label>
						<div class="input-group col-sm-4">
							<select class="form-control" name="industry_id" id="industry_id">
								{foreach name="trades" item='tr'}
								  <option value="{$tr.id}" >{$tr.title}</option>
								{/foreach}
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">联系人：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="user" name="user" value="{$ad.user}" value="" class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">联系人手机号：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="store_tel" name="store_tel" value="{$ad.store_tel}" value="" class="form-control" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-sm-2 control-label">店铺logo：</label>
						<div class="input-group col-sm-4">
							<input type="hidden" id="thumb" name="thumb" />
							<input id="upload" name="upload" type="file" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-2 control-label">备注：</label>
						<div class="input-group col-sm-4">
							<textarea name="memo" class="form-control" value="{$ad.memo}" style="height: 180px;"></textarea>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<div class="modal-content" id="map-dialog" style="position:fixed;z-index:1000;background:#fff;left: 17%;top: 5%;right: 5%;display: none;">
	<div class="modal-header" style="padding: 5px;">
		<h4>请选择地点<button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="$('#map-dialog').hide()">×</button></h4></div>
	<div class="modal-body">
		<div class="form-group" style="margin-bottom: 13px;">
			<div class="input-group">
				<input type="text" id="suggestId" class="form-control" placeholder="请输入地址来直接查找相关位置">
				<div class="input-group-btn"><button class="btn btn-default"><i class="icon-search"></i> 搜索</button></div>
			</div>
		</div>
		<div id="searchResultPanel" style="z-index:2;width:300px;height:400px;position:absolute;left:30px;top:50px;"></div>
		<div id="map-container" style="height: 480px; overflow: hidden; position: relative; z-index: 0; background-color: rgb(243, 241, 236); color: rgb(0, 0, 0); text-align: left;">
		</div>
		<div class="modal-footer ">
			<a class="btn btn-default" data-dismiss="modal" onclick="javascript:$('#map-dialog').hide()">取消</a>
			<a onclick="setJW()" class="btn btn-primary ">确认</a>
		</div>
	</div>
	<div id="show"></div>
</div>
{/block} {block name="script"}
<script class="resources library" src="__PLUGIN__/area/area.js" type="text/javascript"></script>
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script>
var surl="admin/agent/index";
	setMenu(surl);
	upload_one('{$ad.thumb}');
	$("#industry_id").val('{$ad.industry_id}');
	$(function() {
		$("#myForm").validate({
			rules: {
				store_name: "required",
				address: "required",
				store_tel: "required"
			},
			messages: {
				store_name: ICON.error + "请输入名称",
				address: ICON.error + "请输入地址",
				store_tel: ICON.error + "请输入联系人手机号码"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
	var opt0 = ["{$ad.province}","{$ad.city}","{$ad.district}"];
	_init_area();
	var Gid = document.getElementById;

	var showArea = function() {

		Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +

			Gid('s_city').value + " - 县/区" +

			Gid('s_county').value + "</h3>"

	}
	//Gid('s_county').setAttribute('onchange', showArea);
	//顶部导航
	$("#li-bar-index").addClass("active");
</script>
{/block}